import MathUtil from '@/MathUtil';
import RandomUtil from '@/RandomUtil';
import SummonCommon from 'code/Core/Common/SummonCommon';
import UnitCommon from 'code/Core/Common/UnitCommon';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/* 自然之种 */
export default class DLY_SeedOfNature extends AbilityBase {
    static instance: DLY_SeedOfNature;
    constructor(id: string) {
        super(id);
        DLY_SeedOfNature.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {}
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        let lv = this.getAbilityLevel(source);
        let count = R2I(2 + lv / 2);
        let fp = UnitCommon.getFullProperty(source);
        SummonCommon.summon({
            abilityId: this.id,
            unitTypeId: 'efon',
            caster: source,
            x: tarX,
            y: tarY,
            attr: {
                life: fp * 0.6 * lv + 150 * lv,
                attack: 10 * lv + (fp * lv) / 24,
                附加护甲: 10 * lv + (fp * lv) / 24,
                附加魔抗: 10 * lv + (fp * lv) / 24,
            },
            lifeTime: 30 + 5 * lv,
            radius: 300,
            count,
            effect: 'Objects\\Spawnmodels\\NightElf\\EntBirthTarget\\EntBirthTarget.mdl',
        });
    }
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
